using System;
using System.IO;

using Gazebo.MonoAudio;

namespace Gazebo.Core
{
    public static class SoundManager
    {
        private static SoundPlayer player = new SoundPlayer();
        
        public static void PlaySound(string url)
        {
            if (!CorePreferences.Instance.PlaySounds) {
                return;
            }
            
            player.Stop();
            player.SoundLocation = url;
            player.Load();
            player.Play();
        }
        
        public static void PlaySound(Stream data)
        {
            if (!CorePreferences.Instance.PlaySounds) {
                return;
            }
            
            player.Stop();
            player.Stream = data;
            player.Load();
            player.Play();
        }
    }
}
